/* eslint valid-jsdoc: "off" */

'use strict';
const path = require('path');
/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = appInfo => {
  /**
   * built-in config
   * @type {Egg.EggAppConfig}
   **/
  const config = exports = {};

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1606784139200_7518';

  // add your middleware config here
  config.middleware = [];

  // add your user config here
  const userConfig = {
    // myAppName: 'egg',
  };
  //配置默认访问路径 
  config.static = {
    prefix:'/',
    dir:path.join(appInfo.baseDir,'app/public')
  }

  //配置默认模板引擎
  config.view={
    defaultViewEngine:'nunjucks'
  };
  //配置跨域请求
  config.cors={
    origin:'*',
    //允许跨域请求携带cookies
    credentials:true,
    allowMethods:'GET,HEAD,PUT,POST,DELETE,PATCH'
  };
  //配置csrf检测
  config.security = {
    csrf :{
      enable:false,
    }
  }
  //配置jwt秘钥
  config.jwt={
    secret:'myong'
  }
  //配置sequelize  数据库
  config.sequelize = {
    dialect:'mysql',
    database:'sequelize',
    host:'localhost',
    port:3306,
    username:'root',
    password:'qazplm123',
    timezone:'+08:00',
  }
  return {
    ...config,
    ...userConfig,
  };
};
